package com.xianbeiying.app.ckgl.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;

import com.xianbeiying.app.ckgl.R;
import com.xianbeiying.app.ckgl.adapter.ChoiceGhAdapter;

/**
 * 选择大棚
 */
public class ChoiceGreenHouseActivity extends FragmentActivity  implements View.OnClickListener{
    private GridView choice_gh_grid;
    private ImageView iv_title_left;
    private TextView tv_title;
    private TextView tv_right_title;
    private ChoiceGhAdapter choiceGhadapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_choice_green_house);
        initView();
    }
    private void initView() {
        choice_gh_grid=(GridView) findViewById(R.id.choice_gh_grid);
        iv_title_left=(ImageView) findViewById(R.id.iv_title_left);
        tv_right_title=(TextView) findViewById(R.id.tv_right_title);
        tv_title=(TextView) findViewById(R.id.tv_title);
        iv_title_left.setOnClickListener(this);
        tv_right_title.setOnClickListener(this);
//        choiceGhadapter=new ChoiceGhAdapter(this);
//        choice_gh_grid.setAdapter(choiceGhadapter);
        tv_right_title.setText("确定");
        tv_title.setText("选择大棚");
        choice_gh_grid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
               startActivity(new Intent().setClass(ChoiceGreenHouseActivity.this,ChoicePlantActivity.class));
            }
        });
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.iv_title_left:
                 finish();
                break;
            case R.id.tv_right_title:
                break;
        }
    }
}
